<?php

namespace app\common\controller;

/**
 * 用户基类
 * Class User
 * @package app\common\controller
 */
class User extends Front
{

    /**
     * 初始化
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    protected function _initialize()
    {
        parent::_initialize();

        if (!is_login()) {
            $this->redirect('user/passport/login');
        }

        if ($uid = is_login()) {
            $this->uid = $uid;
        }

//        if ($this->is_wechat() && !session('wechat_user')) {
//            $user = &load_wechat('User');
//            $wechat_user = $user->getUserInfo($this->wechat_oauth['openid']);
//            //更新用户信息
//            session('wechat_user', $wechat_user);
//        }
//        $this->assign('wechat_user', session('wechat_user'));
    }

}
